<template>
    <div class="courses-nav">
        <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="horizontal" :router="true">
            <el-menu-item
                index="/Admin/Production/Course"
                :route="{
                    path: '/Admin/Production/Course',
                    query: {
                        tab: 1
                    },
                }"
            >
            预制课程
            </el-menu-item>
            <el-menu-item
                v-if="roles == 'INTERNET_ADMIN'"
                index="/Admin/Production/teacherCourse"
                :route="{
                    path: '/Admin/Production/teacherCourse',
                    query: {
                        tab: 2
                    },
                }"
            >教师制作</el-menu-item>
            <el-menu-item index="/Admin/Production/ReportTemplate">报告模板</el-menu-item>
            <!-- <el-menu-item index="/Admin/Production/CreateSkills">技能标签</el-menu-item> -->
            <!-- <el-menu-item index="/Admin/Production/IndustryCase">行业案例</el-menu-item> -->
            <el-menu-item index="/Admin/Production/JobAdd">岗位添加</el-menu-item>
            <el-menu-item v-if="roles == 'INTERNET_ADMIN'" index="/Admin/Production/Professional">专业方向</el-menu-item>
        </el-menu>
    </div>
</template>

<script>
    export default {
        data () {
            return {
                activeIndex: '',
                //登录角色 ''未登录 TEACHER 教师 ADMIN管理员 STUDENT学生
                roles: ""
            }
        },
        created () {
            let self = this
            self.fetchDate()
            // 从状态管理获取roles
            self.roles = self.$store.state.user.roles[0];
        },
        methods: {
            fetchDate() {
                let self = this
                var cur_path = self.$route.meta.navActive; //获取当前路由
                self.activeIndex = cur_path
            },
            handleSelect(key, keyPath) {
                console.log(key, keyPath)
            }
        },
        watch: {
            "$route": "fetchDate"
		}
    }
</script>
<style lang="scss" scoped>
    .courses-nav{
        .el-menu-demo{
            .el-menu-item{
                &:hover{
                     color:#1277eb
                }
            }
        }
    }
</style>
